package cz.proks.easyhelpdesk.gwt.ui.widget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.HeadingElement;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;

import cz.proks.easyhelpdesk.gwt.ui.resource.HeadingResources;

public abstract class AHeading extends Widget implements HasText {    
    private HeadingResources resources;    
     
    public AHeading() {
        setResources((HeadingResources) GWT.create(HeadingResources.class));
    }
    
    public HeadingResources getResources() {
        return resources;
    }
    
    public void setResources(HeadingResources resources) {
        this.resources = resources;
        this.resources.style().ensureInjected();
    }

    @Override
    public String getText() {
        return HeadingElement.as(getElement()).getInnerText();
    }

    @Override
    public void setText(String text) {
        HeadingElement.as(getElement()).setInnerText(text);
    }    
}
